<template>
  <div class="user-card" @click.native="goUser(cardInfo.user)">
    <el-avatar v-if="cardInfo.avatar" class="user-avatar" :size="50"  :src="cardInfo.avatar"></el-avatar>
    <el-avatar v-else :size="50" class="user-avatar" icon="el-icon-user-solid"></el-avatar>
    <div class="user-content">
      <div class="user-nickname">{{cardInfo.nickname}}</div>
      <div class="user-signature">{{cardInfo.signature}}</div>
    </div>
    <el-button type="primary">关注</el-button>
  </div>
</template>

<script>
export default {
  name: 'UserCard',
  props: {
    cardInfo: {
      type: Object,
      default: () => {}
    }
  }
}
</script>

<style scoped>
  .user-card {
    background: white;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    justify-items: center;
    align-items: center;
    border-bottom: 1px solid #eee;
  }
  .user-avatar{
    width: 100%;
  }
  .user-content{
    margin-left: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }
  .user-nickname {
    font-size: 1.4rem;
    margin: 4px 0px 4px 0px;
    white-space: nowrap;
    overflow: hidden;
  }
</style>
